﻿<%@ Page Language="C#" MasterPageFile="~/MuseumOwner.master" AutoEventWireup="true"
    CodeFile="SearchSettings.aspx.cs" Inherits="SearchSettings" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
<script type="text/javascript" language="JavaScript">
function checkAtLeastOneCheckBox(regex,current) {
	count = 0;
    re = new RegExp(regex);
    for(i = 0; i < document.forms[0].elements.length; i++) {
        elm = document.forms[0].elements[i];
        if (elm.type == 'checkbox') {
            if (elm.checked) {
                count++
            }
        }
    }
	
	if(count == 0){
		alert("You must choose at least one search criteria.");
		return false;
	}
	return true;
}
</script>
    <table width="70%" cellspacing="2" cellpadding="2" border="0">
        <tr>
            <td colspan="2" align="center">
                <b style="font-size: x-large;">SEARCH SETTINGS</b>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                &nbsp;<br />
            </td>
        </tr>
        <tr>
            <td>
                <asp:Label ID="lblMuseumName" Text="Museum:" runat="server"></asp:Label>
            </td>
            <td>
                <asp:DropDownList ID="ddlMuseum" runat="server" Width="200px" DataTextField="MuseumName"
                    DataValueField="MuseumID" AutoPostBack="true"
                    OnSelectedIndexChanged="ddlMuseum_SelectedIndexChanged">
                </asp:DropDownList>
            </td>
        </tr>
        <tr>
            <td colspan="2">
                &nbsp;<br />
            </td>
        </tr>
        <tr>
            <td>
                <asp:CheckBox ID="chkArtName" runat="server" Text="Art Name" />
            </td>
            <td>
                <asp:CheckBox ID="chkStop" runat="server" Text="Stop" />
            </td>
        </tr>
        <tr>
            <td>
                <asp:CheckBox ID="chkArtistName" runat="server" Text="Artist Name" />
            </td>
            <td>
                <asp:CheckBox ID="chkFloor" runat="server" Text="Floor" />
            </td>
        </tr>
        <tr>
            <td>
                <asp:CheckBox ID="chkGallery" runat="server" Text="Gallery" />
            </td>
            <td>
                &nbsp;
            </td>
        </tr>
        <tr>
            <td colspan="2">
                &nbsp;<br />
            </td>
        </tr>
        <tr>
            <td>
                &nbsp;
            </td>
            <td>
                <asp:Button ID="btnSubmit" Text="Submit" runat="server" OnClick="btnSubmit_Click" OnClientClick="return checkAtLeastOneCheckBox('chk,this');" />
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:Label ID="lblResult" runat="server" Visible="false" ForeColor="Red" />
            </td>
        </tr>
    </table>
</asp:Content>
